package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.system.service.ISysBoardSuperviseService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysBoardSupervise;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【项目经理管理看板】Controller
 * 
 * @author ruoyi
 * @date 2022-02-22
 */
@RestController
@RequestMapping("/system/supervise")
public class SysBoardSuperviseController extends BaseController
{
    @Autowired
    private ISysBoardSuperviseService sysBoardSuperviseService;

    /**
     * 查询【项目经理管理看板】列表
     */
    @PreAuthorize("@ss.hasPermi('system:supervise:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysBoardSupervise sysBoardSupervise)
    {
        startPage();
        List<SysBoardSupervise> list = sysBoardSuperviseService.selectSysBoardSuperviseList(sysBoardSupervise);
        return getDataTable(list);
    }


    /**
     * 根据具体日期获取该天的项目详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:supervise:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(sysBoardSuperviseService.selectSysBoardSuperviseById(id));
    }

    /**
     * 新增【日程管理看板】
     */
    @PreAuthorize("@ss.hasPermi('system:supervise:add')")
    @Log(title = "【新增日程管理看板】", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody SysBoardSupervise sysBoardSupervise)
    {
        return toAjax(sysBoardSuperviseService.insertSysBoardSupervise(sysBoardSupervise));
    }

    /**
     * 修改【日程管理看板】
     */
    @PreAuthorize("@ss.hasPermi('system:supervise:edit')")
    @Log(title = "【修改日程管理看板】", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    public AjaxResult edit(@RequestBody SysBoardSupervise sysBoardSupervise)
    {
        return toAjax(sysBoardSuperviseService.updateSysBoardSupervise(sysBoardSupervise));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:supervise:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysBoardSuperviseService.deleteSysBoardSuperviseByIds(ids));
    }
}
